package rulebase;

import java.awt.event.ActionListener;
import java.awt.event.ItemListener;

import javax.swing.DefaultComboBoxModel;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JTextField;


public class MorphophoneticSuffixSpelloutRulePanel extends JPanel
{
	
	private JList MorphophoneticSufFeaturesList;
	private JComboBox cbxMorphophoneticSuffix;
	private JComboBox cbxMorphophoneticSufInfix;
	private JComboBox cbxMorphophoneticSufStem;
	private JTextField txtMorphophoneticNewSuffix;
	private JTextField txtMorphophoneticSuffix;
	private JTextField txtMorphophoneticSufInfix;
	private JTextField txtMorphophoneticSufNewInfix;
	private JTextField txtMorphophoneticSufStem;
	private JTextField txtMorphophoneticSufNewStem;
	private JCheckBox chkMorphophoneticSuffixReduplication;
	private JCheckBox chkMorphophoneticSufInfixReduplication;
	private JCheckBox chkMorphophoneticSufStemReduplication;
	
	public MorphophoneticSuffixSpelloutRulePanel()
	{
		setLayout(null);
		initGUI();
	}
	
	private void initGUI()
	{
		MorphophoneticSufFeaturesList = new JList();
		MorphophoneticSufFeaturesList.setBounds(213, 223, 201, 129);
		add(MorphophoneticSufFeaturesList);
		
		JLabel lblMorphophoneticSuffix = new JLabel("Suffix");
		lblMorphophoneticSuffix.setBounds(10, 82, 46, 14);
		add(lblMorphophoneticSuffix);
		
		JLabel lblMorphophoneticSufInfix = new JLabel("Infix");
		lblMorphophoneticSufInfix.setBounds(222, 82, 46, 14);
		add(lblMorphophoneticSufInfix);
		
		JLabel lblMorphophoneticSufNewInfix = new JLabel("New Infix");
		lblMorphophoneticSufNewInfix.setBounds(222, 113, 57, 14);
		add(lblMorphophoneticSufNewInfix);
		
		JLabel lblMorphophoneticSufFeatures = new JLabel("Features");
		lblMorphophoneticSufFeatures.setBounds(222, 198, 46, 14);
		add(lblMorphophoneticSufFeatures);
		
		JLabel lblMorphophoneticNewSuffix = new JLabel("New Suffix");
		lblMorphophoneticNewSuffix.setBounds(10, 113, 57, 14);
		add(lblMorphophoneticNewSuffix);
		
		JLabel lblMorphophonecticSufNewStem = new JLabel("New Stem");
		lblMorphophonecticSufNewStem.setBounds(10, 297, 57, 14);
		add(lblMorphophonecticSufNewStem);
		
		JLabel lblMorphophoneticSufStem = new JLabel("Stem");
		lblMorphophoneticSufStem.setBounds(10, 266, 46, 14);
		add(lblMorphophoneticSufStem);
		
		cbxMorphophoneticSuffix = new JComboBox();
		cbxMorphophoneticSuffix.setBounds(10, 11, 150, 20);
		add(cbxMorphophoneticSuffix);
		
		cbxMorphophoneticSufInfix = new JComboBox();
		cbxMorphophoneticSufInfix.setBounds(222, 11, 150, 20);
		add(cbxMorphophoneticSufInfix);
		
		cbxMorphophoneticSufStem = new JComboBox();
		cbxMorphophoneticSufStem.setBounds(10, 195, 150, 20);
		add(cbxMorphophoneticSufStem);
		
		txtMorphophoneticSuffix = new JTextField();
		txtMorphophoneticSuffix.setBounds(80, 79, 80, 20);
		add(txtMorphophoneticSuffix);
		txtMorphophoneticSuffix.setColumns(10);
		
		txtMorphophoneticNewSuffix = new JTextField();
		txtMorphophoneticNewSuffix.setBounds(80, 110, 80, 20);
		add(txtMorphophoneticNewSuffix);
		txtMorphophoneticNewSuffix.setColumns(10);
		
		txtMorphophoneticSufNewInfix = new JTextField();
		txtMorphophoneticSufNewInfix.setBounds(292, 113, 80, 20);
		add(txtMorphophoneticSufNewInfix);
		txtMorphophoneticSufNewInfix.setColumns(10);
		
		txtMorphophoneticSufInfix = new JTextField();
		txtMorphophoneticSufInfix.setBounds(292, 82, 80, 20);
		add(txtMorphophoneticSufInfix);
		txtMorphophoneticSufInfix.setColumns(10);
		
		txtMorphophoneticSufStem = new JTextField();
		txtMorphophoneticSufStem.setBounds(80, 263, 80, 20);
		add(txtMorphophoneticSufStem);
		txtMorphophoneticSufStem.setColumns(10);
		
		txtMorphophoneticSufNewStem = new JTextField();
		txtMorphophoneticSufNewStem.setBounds(80, 294, 80, 20);
		add(txtMorphophoneticSufNewStem);
		txtMorphophoneticSufNewStem.setColumns(10);
		
		chkMorphophoneticSuffixReduplication = new JCheckBox("Reduplication");
		chkMorphophoneticSuffixReduplication.setBounds(10, 38, 97, 23);
		add(chkMorphophoneticSuffixReduplication);
		
		chkMorphophoneticSufInfixReduplication = new JCheckBox("Reduplication");
		chkMorphophoneticSufInfixReduplication.setBounds(222, 38, 97, 23);
		add(chkMorphophoneticSufInfixReduplication);
		
		chkMorphophoneticSufStemReduplication = new JCheckBox("Reduplication");
		chkMorphophoneticSufStemReduplication.setBounds(10, 223, 97, 23);
		add(chkMorphophoneticSufStemReduplication);
		
		initCbxMorphophoneticSuffixItems();
		initCbxMorphophoneticSufInfixItems();
		initCbxMorphophoneticSufStemItems();
	}

	private void initCbxMorphophoneticSuffixItems()
	{
		DefaultComboBoxModel model = new DefaultComboBoxModel();
		model.addElement("Suffix doesn't change");
		model.addElement("Beginning of suffix changes");
		model.addElement("Entire suffix changes");
		cbxMorphophoneticSuffix.setModel(model);
	}
	
	private void initCbxMorphophoneticSufInfixItems()
	{
		DefaultComboBoxModel model = new DefaultComboBoxModel();
		model.addElement("Infix doesn't change");
		model.addElement("Beginning of infix changes");
		model.addElement("Entire infix changes");
		cbxMorphophoneticSufInfix.setModel(model);
	}
	
	private void initCbxMorphophoneticSufStemItems()
	{
		DefaultComboBoxModel model = new DefaultComboBoxModel();
		model.addElement("Stem doesn't change");
		model.addElement("Stem changes");
		cbxMorphophoneticSufStem.setModel(model);
	}
	
	public String getCbxSuffix()
	{
		return (String) cbxMorphophoneticSuffix.getSelectedItem();
	}
	
	public String getCbxInfix()
	{
		return (String) cbxMorphophoneticSufInfix.getSelectedItem();
	}
	
	public String getCbxStem()
	{
		return (String) cbxMorphophoneticSufStem.getSelectedItem();
	}
	
	public void getCbxPrefix(String s)
	{
		cbxMorphophoneticSuffix.setSelectedItem(s);
	}
	
	public void getCbxInfix(String s)
	{
		cbxMorphophoneticSufInfix.setSelectedItem(s);
	}
	public void getCbxStem(String s)
	{
		cbxMorphophoneticSufStem.setSelectedItem(s);
	}

	public void setCbxMorphophoneticSuffixListener(ActionListener AL)
	{
		cbxMorphophoneticSuffix.addActionListener(AL);
	}
	
	public void setCbxMorphophoneticSufInfixListener(ActionListener AL)
	{
		cbxMorphophoneticSufInfix.addActionListener(AL);
	}
	
	public void setCbxMorphophoneticSufStemListener(ActionListener AL)
	{
		cbxMorphophoneticSufStem.addActionListener(AL);
	}

	public void setTxtMorphophoneticNewSuffix(String s)
	{
		txtMorphophoneticNewSuffix.setText(s);
	}
	
	public void setTxtMorphophoneticSuffix(String s)
	{
		txtMorphophoneticSuffix.setText(s);
	}
	
	public void setTxtMorphophoneticSufInfix(String s)
	{
		txtMorphophoneticSufInfix.setText(s);
	}
	
	public void setTxtMorphophoneticSufNewInfix(String s)
	{
		txtMorphophoneticSufNewInfix.setText(s);
	}
	
	public void setTxtMorphophoneticSufStem(String s)
	{
		txtMorphophoneticSufStem.setText(s);
	}
	
	public void setTxtMorphophoneticSufNewStem(String s)
	{
		txtMorphophoneticSufNewStem.setText(s);
	}

	public String getTxtMorphophoneticNewSuffix()
	{
		return txtMorphophoneticNewSuffix.getText();
	}
	
	public String getTxtMorphophoneticSuffix()
	{
		return txtMorphophoneticSuffix.getText();
	}
	
	public String getTxtMorphophoneticSufInfix()
	{
		return txtMorphophoneticSufInfix.getText();
	}
	
	public String getTxtMorphophoneticSufNewInfix()
	{
		return txtMorphophoneticSufNewInfix.getText();
	}

	public String getTxtMorphophoneticSufStem()
	{
		return txtMorphophoneticSufStem.getText();
	}
	
	public String getTxtMorphophoneticSufNewStem()
	{
		return txtMorphophoneticSufNewStem.getText();
	}

	public void setChkMorphophoneticSuffixReduplication(ItemListener IL)
	{
		chkMorphophoneticSuffixReduplication.addItemListener(IL);
	}
	
	public void setChkMorphophoneticSufInfixReduplication(ItemListener IL)
	{
		chkMorphophoneticSufInfixReduplication.addItemListener(IL);
	}
	
	public void setChkMorphophoneticSufStemReduplication(ItemListener IL)
	{
		chkMorphophoneticSufStemReduplication.addItemListener(IL);
	}
}
